#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
typedef struct Element
{
    int num;
    int count;
}Element;

int majorityElement(int* nums, int numsSize) {
    Element element;
    element.count = 0;
    for (int i = 0; i < numsSize; i++)
    {
        if (element.count == 0)
        {
            element.num = nums[i];
        }
        if (element.num == nums[i])
        {
            element.count++;
        }
        else
        {
            element.count--;
        }
    }
    return element.num;
}

int main()
{
    int len = 0;
    scanf("%d", &len);
    int* arr = (int*)malloc(sizeof(int) * len);
    for (int i = 0; i < len; i++)
    {
        scanf("%d", &arr[i]);
    }
    int ret = majorityElement(arr, len);
    printf("%d", ret);
    return 0;
}